GtkSwitch: Initialize offset when beginning animation
authorMatthias Clasen <mclasen@redhat.com>
Mon, 4 Aug 2014 12:35:15 +0000 (14:35 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 4 Aug 2014 12:36:42 +0000 (14:36 +0200)
handle_x always corresponds to the visible position of the handle,
which is where we want to start the animation. Without this, repeated
keyboard activation will not always animate.

gtk/gtkswitch.c

index 28962d2a9be311ac98809f700e3c6e6e9d9ce326..e9b4fcc1a0249db632559d9e49a3e8d5a1f74d4f 100644 (file)
@@ -188,6 +188,7 @@ gtk_switch_begin_toggle_animation (GtkSwitch *sw)
       GdkFrameClock *clock = gtk_widget_get_frame_clock (GTK_WIDGET (sw));
       priv->start_time = gdk_frame_clock_get_frame_time (clock);
       priv->end_time = priv->start_time + 1000 * ANIMATION_DURATION;
+      priv->offset = priv->handle_x;
       if (priv->tick_id == 0)
         {
           priv->tick_id = g_signal_connect (clock, "update",